"""
model name : 深度学习
file       : xywh2xyxy.py
information:
    author : OuYang
    time   : 2025/1/18
"""


def xywh2xyxy(xywh, s=7):
    cell_size = 1.0 / s

    x, y, w, h = xywh

    x1 = x * cell_size - w / 2
    y1 = y * cell_size - h / 2
    x2 = x * cell_size + w / 2
    y2 = y * cell_size + h / 2

    return x1, y1, x2, y2
